package morenoapp.model.impl;

import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import morenoapp.model.data.MorenoAnswerFace;
import morenoapp.model.data.MorenoMetricFilterFace;
import morenoapp.model.enums.MorenoQuestionType;
import morenoapp.model.data.MorenoQuestionFace;

/**
 *
 * @author dmitry.mamonov
 */
public class MorenoMetricFilterImpl implements MorenoMetricFilterFace {
    private Set<MorenoQuestionFace> questionSet;

    protected MorenoMetricFilterImpl(Collection<MorenoQuestionFace> _questions) {
        this.questionSet = new LinkedHashSet(_questions);
    }

    public boolean hasAnswer(MorenoAnswerFace _answer) {
        if (_answer!=null){
            return this.questionSet.contains(_answer.getQuestion());
        } else {
            return false;
        }
    }

    public List getQuestions() {
        throw new UnsupportedOperationException("Not supported yet."); //NOI18N
    }

    public static MorenoMetricFilterFace getFilterByQuestions(Collection<MorenoQuestionFace> _questions){
        return new MorenoMetricFilterImpl(_questions);
    }

    public static MorenoMetricFilterFace getFilterByQuestionType(MorenoQuestionType _questionType){
        return null;
    }

    /**
     * Если аргумент null возвращает полный список вопросов,
     * в противном случае возвращет передынный фильр.
     * @param _filter
     * @return
     */
    public static MorenoMetricFilterFace getWholeFilterIfNull(MorenoMetricFilterFace _filter){
        return null;
    }
}
